﻿namespace EasyCMS.Common.DataComponents
{
    using System;
    using Pismire;

    ///<summary>
    ///EasyCMS
    ///</summary>
    ///<remarks>
    ///编写人: 唐炜
    ///编写时间 :2008-8-29
    ///修订历史
    ///---------------
    ///</remarks>
    [System.Runtime.Serialization.DataContractAttribute(Name = "Subject", Namespace = "http://schemas.datacontract.org/2004/07/EasyCMS.Common.DataComponents")]
    public class Subject : Pismire.Data.DBComponentBase
    {
        public Subject() { }

        public Subject(int categoryID, int adminID, string codeName)
        {
            this.CategoryID = categoryID;
            this.AdminID = adminID;
            this.CodeName = codeName;
        }

        /// <summary>
        /// 主题作者
        /// </summary>
        public Author Author { get; set; }

        #region CategoryID
        /// <summary>
        /// 所属栏目ID，1-MAX，查询条件
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public int CategoryID
        {
            get { return m_CategoryID; }
            set { m_CategoryID = value; }
        }
        private int m_CategoryID;

        /// <summary>
        /// 所属栏目ID，1-MAX，查询条件 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState CategoryID_Validate(ref int categoryID)
        {
            return categoryID.Validation("CategoryID").MoreThan(0).State;
        }
        #endregion

        #region AdminID
        /// <summary>
        /// 所属商户ID，1-MAX，查询条件
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public int AdminID
        {
            get { return m_AdminID; }
            set { m_AdminID = value; }
        }
        private int m_AdminID;

        /// <summary>
        /// 所属商户ID，1-MAX，查询条件 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState AdminID_Validate(ref int AdminID)
        {
            return AdminID.Validation("AdminID").MoreThan(0).State;
        }
        #endregion

        #region CodeName
        /// <summary>
        /// 代码名称，主要用于调用以及URL重写，0-50个中英文数字字符。
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string CodeName
        {
            get { return m_CodeName; }
            set { m_CodeName = value; }
        }
        private string m_CodeName;

        /// <summary>
        /// 代码名称，主要用于调用以及URL重写，0-50个中英文数字字符。 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState CodeName_Validate(ref string codeName)
        {
            return codeName.Validation("CodeName").LengthBetween(0, 50).Text(ValidationMode.Only).BindValue(ref codeName).State;
        }
        #endregion

        #region Text01
        /// <summary>
        /// Text01
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string Text01
        {
            get { return m_Text01; }
            set { m_Text01 = value; }
        }
        private string m_Text01;

        /// <summary>
        /// Text01 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Text01_Validate(ref string text01)
        {
            return text01.Validation("Text01").LengthBetween(0, 255).Text(ValidationMode.Only).BindValue(ref text01).State;
        }
        #endregion

        #region Text02
        /// <summary>
        /// Text02
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string Text02
        {
            get { return m_Text02; }
            set { m_Text02 = value; }
        }
        private string m_Text02;

        /// <summary>
        /// Text02 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Text02_Validate(ref string text02)
        {
            return text02.Validation("Text02").LengthBetween(0, 255).Text(ValidationMode.Only).BindValue(ref text02).State;
        }
        #endregion

        #region Text03
        /// <summary>
        /// Text03
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string Text03
        {
            get { return m_Text03; }
            set { m_Text03 = value; }
        }
        private string m_Text03;

        /// <summary>
        /// Text03 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Text03_Validate(ref string text03)
        {
            return text03.Validation("Text03").LengthBetween(0, 255).Text(ValidationMode.Only).BindValue(ref text03).State;
        }
        #endregion

        #region Text04
        /// <summary>
        /// Text04
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string Text04
        {
            get { return m_Text04; }
            set { m_Text04 = value; }
        }
        private string m_Text04;

        /// <summary>
        /// Text04 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Text04_Validate(ref string text04)
        {
            return text04.Validation("Text04").LengthBetween(0, 255).Text(ValidationMode.Only).BindValue(ref text04).State;
        }
        #endregion

        #region Text05
        /// <summary>
        /// Text05
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string Text05
        {
            get { return m_Text05; }
            set { m_Text05 = value; }
        }
        private string m_Text05;

        /// <summary>
        /// Text05 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Text05_Validate(ref string text05)
        {
            return text05.Validation("Text05").LengthBetween(0, 255).Text(ValidationMode.Only).BindValue(ref text05).State;
        }
        #endregion

        #region Link01
        /// <summary>
        /// Link01
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string Link01
        {
            get { return m_Link01; }
            set { m_Link01 = value; }
        }
        private string m_Link01;

        /// <summary>
        /// Link01 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Link01_Validate(ref string link01)
        {
            return link01.Validation("Link01").LengthBetween(0, 255).Text(ValidationMode.Only).BindValue(ref link01).State;
        }
        #endregion

        #region Link02
        /// <summary>
        /// Link02
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string Link02
        {
            get { return m_Link02; }
            set { m_Link02 = value; }
        }
        private string m_Link02;

        /// <summary>
        /// Link02 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Link02_Validate(ref string link02)
        {
            return link02.Validation("Link02").LengthBetween(0, 255).Text(ValidationMode.Only).BindValue(ref link02).State;
        }
        #endregion

        #region Link03
        /// <summary>
        /// Link03
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string Link03
        {
            get { return m_Link03; }
            set { m_Link03 = value; }
        }
        private string m_Link03;

        /// <summary>
        /// Link03 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Link03_Validate(ref string link03)
        {
            return link03.Validation("Link03").LengthBetween(0, 255).Text(ValidationMode.Only).BindValue(ref link03).State;
        }
        #endregion

        #region Link04
        /// <summary>
        /// Link04
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string Link04
        {
            get { return m_Link04; }
            set { m_Link04 = value; }
        }
        private string m_Link04;

        /// <summary>
        /// Link04 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Link04_Validate(ref string link04)
        {
            return link04.Validation("Link04").LengthBetween(0, 255).Text(ValidationMode.Only).BindValue(ref link04).State;
        }
        #endregion

        #region Link05
        /// <summary>
        /// Link05
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string Link05
        {
            get { return m_Link05; }
            set { m_Link05 = value; }
        }
        private string m_Link05;

        /// <summary>
        /// Link05 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Link05_Validate(ref string link05)
        {
            return link05.Validation("Link05").LengthBetween(0, 255).Text(ValidationMode.Only).BindValue(ref link05).State;
        }
        #endregion

        #region Body01
        /// <summary>
        /// Body01
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string Body01
        {
            get { return m_Body01; }
            set { m_Body01 = value; }
        }
        private string m_Body01;

        /// <summary>
        /// Body01 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Body01_Validate(ref string body01)
        {
            return body01.Validation("Body01").LengthBetween(0, -1).Text(ValidationMode.Only).BindValue(ref body01).State;
        }
        #endregion

        #region Int01
        /// <summary>
        /// Int01
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public int Int01
        {
            get { return m_Int01; }
            set { m_Int01 = value; }
        }
        private int m_Int01;

        /// <summary>
        /// Int01 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Int01_Validate(ref int int01)
        {
            return int01.Validation("Int01").MoreThan(0).State;
        }
        #endregion

        #region Int02
        /// <summary>
        /// Int02
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public int Int02
        {
            get { return m_Int02; }
            set { m_Int02 = value; }
        }
        private int m_Int02;

        /// <summary>
        /// Int02 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Int02_Validate(ref int int02)
        {
            return int02.Validation("Int02").MoreThan(0).State;
        }
        #endregion

        #region Float01
        /// <summary>
        /// Float01
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public float Float01
        {
            get { return m_Float01; }
            set { m_Float01 = value; }
        }
        private float m_Float01;

        /// <summary>
        /// Float01 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Float01_Validate(ref float float01)
        {
            return float01.Validation("Float01").MoreThan(0).State;
        }
        #endregion

        #region Float02
        /// <summary>
        /// Float02
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public float Float02
        {
            get { return m_Float02; }
            set { m_Float02 = value; }
        }
        private float m_Float02;

        /// <summary>
        /// Float02 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Float02_Validate(ref float float02)
        {
            return float02.Validation("Float02").MoreThan(0).State;
        }
        #endregion

        #region DateTime01
        /// <summary>
        /// DateTime01
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public DateTime DateTime01
        {
            get { return m_DateTime01; }
            set { m_DateTime01 = value; }
        }
        private DateTime m_DateTime01;

        /// <summary>
        /// DateTime01 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState DateTime01_Validate(ref DateTime dateTime01)
        {
            return dateTime01.Validation("DateTime01").Between(Pismire.ConstValues.DateTime.MinValue, Pismire.ConstValues.DateTime.MaxValue).State;
        }
        #endregion

        #region DateTime02
        /// <summary>
        /// DateTime02
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public DateTime DateTime02
        {
            get { return m_DateTime02; }
            set { m_DateTime02 = value; }
        }
        private DateTime m_DateTime02;

        /// <summary>
        /// DateTime02 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState DateTime02_Validate(ref DateTime dateTime02)
        {
            return dateTime02.Validation("DateTime02").Between(Pismire.ConstValues.DateTime.MinValue, Pismire.ConstValues.DateTime.MaxValue).State;
        }
        #endregion

        #region Sort
        /// <summary>
        /// 手工排序字段，0-MAX
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public int Sort
        {
            get { return m_Sort; }
            set { m_Sort = value; }
        }
        private int m_Sort;

        /// <summary>
        /// 手工排序字段，0-MAX 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState Sort_Validate(ref int sort)
        {
            return sort.Validation("Sort").MoreThan(0).State;
        }
        #endregion

        #region ViewCount
        /// <summary>
        /// 浏览数，0-MAX，排序条件
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public int ViewCount
        {
            get { return m_ViewCount; }
            set { m_ViewCount = value; }
        }
        private int m_ViewCount;

        /// <summary>
        /// 浏览数，0-MAX，排序条件 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState ViewCount_Validate(ref int viewCount)
        {
            return viewCount.Validation("ViewCount").MoreThan(0).State;
        }
        #endregion

        #region DiggCount
        /// <summary>
        /// 叫好数，0-MAX，排序条件
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public int DiggCount
        {
            get { return m_DiggCount; }
            set { m_DiggCount = value; }
        }
        private int m_DiggCount;

        /// <summary>
        /// 叫好数，0-MAX，排序条件 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState DiggCount_Validate(ref int diggCount)
        {
            return diggCount.Validation("DiggCount").MoreThan(0).State;
        }
        #endregion

        #region StartTime
        /// <summary>
        /// 信息有效时间（开始），查询条件
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public DateTime StartTime
        {
            get { return m_StartTime; }
            set { m_StartTime = value; }
        }
        private DateTime m_StartTime;

        /// <summary>
        /// 信息有效时间（开始），查询条件 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState StartTime_Validate(ref DateTime startTime)
        {
            return startTime.Validation("StartTime").Between(Pismire.ConstValues.DateTime.MinValue, Pismire.ConstValues.DateTime.MaxValue).State;
        }
        #endregion

        #region EndTime
        /// <summary>
        /// 信息有效时间（结束），查询条件
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public DateTime EndTime
        {
            get { return m_EndTime; }
            set { m_EndTime = value; }
        }
        private DateTime m_EndTime;

        /// <summary>
        /// 信息有效时间（结束），查询条件 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState EndTime_Validate(ref DateTime endTime)
        {
            return endTime.Validation("EndTime").Between(Pismire.ConstValues.DateTime.MinValue, Pismire.ConstValues.DateTime.MaxValue).State;
        }
        #endregion

        #region AddTime
        /// <summary>
        /// 添加时间
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public DateTime AddTime
        {
            get { return m_AddTime; }
            set { m_AddTime = value; }
        }
        private DateTime m_AddTime;

        /// <summary>
        /// 添加时间 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState AddTime_Validate(ref DateTime addTime)
        {
            return addTime.Validation("AddTime").Between(Pismire.ConstValues.DateTime.MinValue, Pismire.ConstValues.DateTime.MaxValue).State;
        }
        #endregion

        #region UpdateTime
        /// <summary>
        /// 更新时间，排序条件
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public DateTime UpdateTime
        {
            get { return m_UpdateTime; }
            set { m_UpdateTime = value; }
        }
        private DateTime m_UpdateTime;

        /// <summary>
        /// 更新时间，排序条件 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState UpdateTime_Validate(ref DateTime updateTime)
        {
            return updateTime.Validation("UpdateTime").Between(Pismire.ConstValues.DateTime.MinValue, Pismire.ConstValues.DateTime.MaxValue).State;
        }
        #endregion


        #region IDBComponent Members

        /// <summary>
        /// 检查该实体的所有属性是否合法
        /// </summary>
        /// <returns></returns>
        public override ExcuteState CheckMe()
        {
            ExcuteState state = new ExcuteState();

            state = CategoryID_Validate(ref this.m_CategoryID);
            if (!state.Succeed) { return state; }
            state = AdminID_Validate(ref this.m_AdminID);
            if (!state.Succeed) { return state; }
            state = CodeName_Validate(ref this.m_CodeName);
            if (!state.Succeed) { return state; }
            state = Text01_Validate(ref this.m_Text01);
            if (!state.Succeed) { return state; }
            state = Text02_Validate(ref this.m_Text02);
            if (!state.Succeed) { return state; }
            state = Text03_Validate(ref this.m_Text03);
            if (!state.Succeed) { return state; }
            state = Text04_Validate(ref this.m_Text04);
            if (!state.Succeed) { return state; }
            state = Text05_Validate(ref this.m_Text05);
            if (!state.Succeed) { return state; }
            state = Link01_Validate(ref this.m_Link01);
            if (!state.Succeed) { return state; }
            state = Link02_Validate(ref this.m_Link02);
            if (!state.Succeed) { return state; }
            state = Link03_Validate(ref this.m_Link03);
            if (!state.Succeed) { return state; }
            state = Link04_Validate(ref this.m_Link04);
            if (!state.Succeed) { return state; }
            state = Link05_Validate(ref this.m_Link05);
            if (!state.Succeed) { return state; }
            state = Body01_Validate(ref this.m_Body01);
            if (!state.Succeed) { return state; }
            state = Int01_Validate(ref this.m_Int01);
            if (!state.Succeed) { return state; }
            state = Int02_Validate(ref this.m_Int02);
            if (!state.Succeed) { return state; }
            state = Float01_Validate(ref this.m_Float01);
            if (!state.Succeed) { return state; }
            state = Float02_Validate(ref this.m_Float02);
            if (!state.Succeed) { return state; }
            state = DateTime01_Validate(ref this.m_DateTime01);
            if (!state.Succeed) { return state; }
            state = DateTime02_Validate(ref this.m_DateTime02);
            if (!state.Succeed) { return state; }
            state = Sort_Validate(ref this.m_Sort);
            if (!state.Succeed) { return state; }
            state = ViewCount_Validate(ref this.m_ViewCount);
            if (!state.Succeed) { return state; }
            state = DiggCount_Validate(ref this.m_DiggCount);
            if (!state.Succeed) { return state; }
            state = StartTime_Validate(ref this.m_StartTime);
            if (!state.Succeed) { return state; }
            state = EndTime_Validate(ref this.m_EndTime);
            if (!state.Succeed) { return state; }
            state = AddTime_Validate(ref this.m_AddTime);
            if (!state.Succeed) { return state; }
            state = UpdateTime_Validate(ref this.m_UpdateTime);
            if (!state.Succeed) { return state; }

            return state;
        }

        #endregion
    }
}
